package demoFactoryProxy;

public class ProxyUser {
    private User realUser;
    public ProxyUser(User user){
        this.realUser = user;
    }
    public void borrowedBook(String bookName){
        if(this.realUser instanceof NormalUser){
            ((NormalUser)(this.realUser)).borrowedBook(bookName);
        }else {
            System.out.println("您没有借书的权限...");
        }
    }
    public void addBook(String bookName){
        if(this.realUser instanceof AdminUser){
            ((AdminUser)(this.realUser)).addBook(bookName);
        }else{
            System.out.println("您没有添加书籍的权限...");
        }
    }
}
